package com.aaa.hospital.service.impl;

import com.aaa.hospital.mapper.DocMapper;
import com.aaa.hospital.pojo.domain.Info;
import com.aaa.hospital.pojo.vo.PatientVo;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.DocService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author:张海金
 * Description:T0D0
 * DateTime:2022/1/17 19:48
 **/
@Service
public class DocServiceImpl implements DocService {

    @Autowired
    private DocMapper docMapper;

    @Override
    public AjaxResult list() {

        //查询所有医生返回到Controller
        List<Info> infos = docMapper.listAllDoctor();
        return AjaxResult.success(infos);
    }


    @Override
    public AjaxResult addPatient(PatientVo patientVo) {
        //病人挂号

        patientVo.setState(0);

        int i = docMapper.addPatient(patientVo);

        Integer state = patientVo.getState();

//        System.out.println("========" + state + "========");

        if(i>0){
            return AjaxResult.success();
        }else {
            return AjaxResult.fail();
        }
    }
}
